123456/V5 PT 2324/index.php

<!DOCTYPE html> <html> <head> <style> h1 { font-family: roboto; margin-left: 30px } h2 { font-family: roboto; margin-left: 30px; margin-bottom: 5px; } #rlink { font: normal normal 14px/16px "Courier New", Courier, Monospace; text-decoration: none; margin-bottom: 20px; } span { font: normal normal 14px/16px "Courier New", Courier, Monospace } table, td, th { border: 1px solid #000; border-collapse: collapse } pre { background: #f4f4f4; border-radius: 4px; border: 1px solid #ddd; border-left: 3px solid #f36d33; color: #1c1c1c; page-break-inside: avoid; font: normal normal 14px/16px "Courier New", Courier, Monospace; line-height: 1; margin-bottom: 1.6em; max-width: 100%; padding: .5em 1em; display: block; word-wrap: break-word; margin-left: 30px; overflow: auto; overflow-x: auto; white-space: pre-wrap; counter-reset: line; max-height: 350px; } pre:focus, pre:hover { border-left: 3px solid #338df3 } div.code { position: relative } .hide-btn { float: right; -webkit-transition-duration: 0.4s; /* Safari */ transition-duration: 0.4s; background-color: transparent; color: black; border: 2px solid #338df3; border-radius: 20px; padding: 5px 20px; outline: 0; } .hide-btn:hover { background-color: #338df3; color: white; } .hidden { display: none; } pre+button { position: absolute; top: 0; right: 0 } pre .line-number { float: left; margin: 0 1em 0 -1em; border-right: 1px solid; text-align: right } pre .line-number span { display: block; padding: 0 .5em 0 1em } pre .cl { display: block; clear: both } .codeButton { background-color: transparent; -moz-border-radius: 2px; -webkit-border-radius: 2px; border-radius: 2x; border: 1px solid; display: inline-block; cursor: pointer; color: #000; font-family: Arial; font-size: 14px; padding: 2px 2px; text-decoration: none; margin: 2px 2px } .codeButton:hover { background-color: transparent } .codeButton:active { top: 1px } .frame { border: none; width: 100%; border-radius: 4px; } .tree { width: 12%; height: 93vh; float: left; overflow: scroll; margin-right: 10px; } .tree ul { padding-left: 10px; } ul.tree li { list-style-type: none; position: relative } ul.tree li ul { display: none } ul.tree li.open>ul { display: block } ul.tree li a { color: #000; text-decoration: none; padding-right: 10px; } ul.tree li a:before { height: 1em; padding: 0 .1em; font-size: .8em; display: block; position: absolute; left: -1.3em; top: .2em } ul.tree li>a:not(:last-child):before { content: '+' } ul.tree li.open>a:not(:last-child):before { content: '-' } </style> <script> window.onload = () => { createTrees(); codeView(); codeFold(); // injectCode(); } function codeView() { var pres = document.getElementsByClassName('linenummer'); for (var i = 0; i < pres.length; i++) { var pre = pres[i]; var r = pre.innerHTML.split(/\n/); pre.innerHTML = '<span class="line-number shown"></span>' + pre.innerHTML + '<span class="cl"></span>' var num = r.length for (var j = 0; j < num; j++) { var lineNum = pre.getElementsByTagName('span')[0] lineNum.innerHTML += '<span>' + (j + 1) + '</span>' } } } function frameUpdate(t) { const url = t.contentWindow.location.href; var a = document.getElementById('rlink'); a.href = url; a.innerHTML = url; } function codeFold() { var pres = document.getElementsByTagName('pre'); for (var i = 0; i < pres.length; i++) { var pre = pres[i]; var heigth = pre.clientHeight; var btns = pre.getElementsByClassName("hide-btn"); for (var j = 0; j < btns.length; j++) { const btn = btns[j]; btn.onclick = (function() { var p = pre; return () => foldCode(p, btn); })(); } } } function foldCode(pre, btn) { var shows = pre.getElementsByClassName("shown"); for (let i = 0; i < shows.length; i++) { const s = shows[i]; s.classList.toggle("hidden"); } var text = btn.firstChild; const s = text.data == "Show"; text.data = s ? "Hide" : "Show"; return s; } function createTrees() { var tree = document.querySelectorAll('ul.tree a:not(:last-child)'); for (var i = 0; i < tree.length; i++) { tree[i].addEventListener('click', function (e) { var parent = e.target.parentElement; var classList = parent.classList; if (classList.contains("open")) { classList.remove('open'); var opensubs = parent.querySelectorAll(':scope .open'); for (var i = 0; i < opensubs.length; i++) { opensubs[i].classList.remove('open'); } } else { classList.add('open'); } e.preventDefault(); }); } } </script> <script crossorigin="anonymous"src="https://kit.fontawesome.com/ac8022e552.js"></script></head><body> <?php function h($mes) { echo "<h1>$mes</h1>"; st(true); } function n($mes) { echo "$mes\n"; } function b() { echo "<h2>Resultaat</h2>"; echo "<a id='rlink' target='_blank'></a>"; } function bb() { eh(); b(); st(false); } $codeCount = 0; function st($linenummer) { $codeCount++; if($linenummer) { echo "<pre class='linenummer'>"; echo "<div><button class='hide-btn'>Hide</button></div>"; echo "<code class='code shown'><span id='code${codeCount}'>"; } else { echo "<pre>"; echo "<code class='code'><span id='code${codeCount}'>"; } } function eh() { echo "</span></code></pre>"; } class Dir { public $dirs = []; public $files = []; private $location; public function __construct($parentLocation, $name) { $this->location = "$parentLocation/$name"; $this->name = $name; } public function load() { $iterator = new DirectoryIterator($this->location); foreach ($iterator as $item) { $name = $item->getFileName(); if ($name == '.' || $name == '..') { continue; } if ($item->isDir()) { $dir = new Dir($this->location, $name); $dir->load(); $this->dirs[$name] = $dir; } else { $this->files[$name] = true; } } } public function order() { ksort($this->dirs); foreach ($this->dirs as $dir) { $dir->order(); } ksort($this->files); } public function echoContent($prefix, $fprefix = '') { if (strlen($prefix) == 0) { echo '<ul class="tree">'; } else { echo '<ul>'; } foreach ($this->dirs as $name => $dir) { $pn = $this->prefixAndName($prefix, $name); $path = str_replace("~", ".", $_GET['xfile']); $open = $this->startsWith($path, $pn); if($open) { echo "<li class='open'>"; } else { echo "<li>"; } echo "<a href=\"#\">$name</a>"; $dir->echoContent($pn, $this->prefixAndName($fprefix, $name, "~")); echo "</li>"; } $ignore = array(".htacces.php",".vscode.php", ".haccess", ".htacces.php", ".htaccess");//"index.php", foreach ($this->files as $name => $folder) { if (!($this->endsWith($name, ".js") || $this->endsWith($name, ".php") || $this->endsWith($name, ".txt")|| $this->endsWith($name, ".html"))) continue; if(in_array($name, $ignore)) continue; // $pan = $this->stripName($name); $url = $this->getUrl(); $fpn = $this->prefixAndName($fprefix, $name, "~"); echo "<li><a href=\"${url}?xfile=$fpn\">$name</a></li>"; } echo "</ul>"; } function startsWith($string, $startString) { return strpos($string, $startString) === 0; } private function endsWith($haystack, $needle) { $length = strlen($needle); if ($length == 0) { return true; } return (substr($haystack, -$length) === $needle); } private function getUrl() { $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $url = strtok($actual_link, '?'); return $url; } private function stripName($name) { $pn = $name; // $pn = str_replace('.php', '', $pn); return $pn; } private function prefixAndName($prefix, $name, $link = ".") { $pn = $this->stripName($name); if (strlen($prefix) > 0) { $pn = $prefix . $link . $pn; } return $pn; } } function startsWith($string, $startString) { return strpos($string, $startString) === 0; } function printFile($file) { $orig = file_get_contents($file); $b = startsWith($a, "<?php"); $a = htmlentities($orig); if($b) { $a = substr($a, 9); $a = substr($a, 0, strlen($a) - 5); } echo $a; } $mainDir = new Dir(".", ""); $mainDir->load(); $mainDir->order(); $mainDir->echoContent(''); $file = $_GET["xfile"]; if (strlen($file) > 0) { $path = str_replace("~", "/", $file); h("${path}"); //h("${path}.php"); printFile("./${path}"); //printFile("./${path}.php"); bb(); // include "./${path}.php"; echo "<iframe class='frame' src='${path}' onLoad='frameUpdate(this)'></iframe>"; //echo "<iframe class='frame' src='${path}.php' onLoad='frameUpdate(this)'></iframe>"; eh(); } ?> <span>Made by Thijs Aarnoudse</span> </body> </html>

Resultaat

Made by Thijs Aarnoudse